package vip.xiaonuo.core.config;

import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.cache.jedis.RedisCacheService;
import org.noear.solon.data.cache.CacheService;
import org.noear.solon.data.cache.CacheTagsService;
import org.noear.solon.data.cache.CacheTagsServiceImpl;

@Slf4j
@Configuration
public class CacheConfig {
    @Bean(name = "CacheRedis")
    public CacheService cacheRedis(@Inject("${solon.redis}") RedisCacheService cache) {
        log.info("CacheService 初始化");
        cache.enableMd5key(false);
        return cache;
    }

    @Bean
    public CacheTagsService cacheTagsService(@Inject(value = "CacheRedis") CacheService cacheService) {
        log.info("CacheTagsService 初始化");
        return new CacheTagsServiceImpl(cacheService);
    }
}